import MySQLdb
import threading
import sys
def db_op_thread_func( i, num_of_op ):
    
    sql = "select * from xxxx"
    for j in range(0, int(num_of_op) ):
        print "thread", i, ":", " num:", j

if __name__ == "__main__":
    args = sys.argv
    num_of_thd  = 2
    num_of_op   = 1
    threads = []
    for i in range( 0, int(num_of_thd) ):
        threads.append( threading.Thread( target=db_op_thread_func,args=(i, num_of_op ) ) )
 
    for t in threads:
        t.start()
 
    for t in threads:
        t.join()
